<template>
  <div class="summer">
    <!-- <div class="title-tabs" v-show="fixed">
    
      </div> -->
    <div class="headtitle" :class="{ fixed: fixed }">
      <div class="back">
        <van-icon
          class="arrow-left"
          name="arrow-left"
          @click="$router.back()"
        />
      </div>
      <div class="title-tabs" v-show="fixed">
        爆品专区
      </div>
    </div>
    <div class="bgimg">
      <img
        src="http://www.higuang365.com/public/images/common/activity/2261activity/bgtop3.jpg"
      />
    </div>
    <GoodsList></GoodsList>
  </div>
</template>
<script>
import { defineComponent, reactive, toRefs, nextTick } from "vue";
import GoodsList from "@/components/promotion/summerGoods.vue";
export default defineComponent({
  name: "peoplebuy",
  components: {
    GoodsList,
  },
  setup() {
    const data = reactive({
      fixed: false,
    });

    nextTick(() => {
      document.getElementById("app").addEventListener("scroll", () => {
        const scrollTop = document.getElementById("app").scrollTop;
        data.fixed = Math.abs(Math.round(scrollTop)) < 300 ? false : true;
      });
    });

    return { ...toRefs(data) };
  },
});
</script>

<style lang="scss" scoped>
.summer {
  min-height: 100vh;
  background: rgb(113, 21, 0);
  img {
    display: block;
  }
  // .title {
  //   position: fixed;
  //   top: 0;
  //   display: flex;
  //   width: 100%;
  //   height: 5rem;
  //   line-height: 5rem;
  //   z-index: 100;
  //   color: #fff;
  //   background: url("http://higuang365.com/public/images/common/promotion/xianshi.jpg")
  //     no-repeat;
  //   background-size: cover;
  // }
  .headtitle {
    position: fixed;
    top: 0;
    display: flex;
    width: 100%;
    height: 5rem;
    line-height: 5rem;
    z-index: 200;
    color: #fff;
    // background: url("http://higuang365.com/public/images/common/promotion/xianshi.jpg")
    //   no-repeat;
    // background-size: cover;
  }
  .back {
    position: absolute;
    left: 2rem;
    top: 0.5rem;

    font-size: 2.4rem;
    .arrow-left {
      color: rgba($color: #ffffff, $alpha: 1);
    }
  }
  .title-tabs {
    margin: 0.5rem auto;
    font-size: 2rem;
    color: #fff;
    font-weight: bold;
    letter-spacing: 3px;
  }
  .fixed {
    // background-image: url("http://www.higuang365.com/public/images/common/promotion/news2.jpg");
    // background-size: cover;
    background-color: #9e0000;
    transition: background 0.5s cubic-bezier(0.39, 0.58, 0.57, 1);
  }
}
</style>
